package com.hl.toolkit.server.tycoin.account.slaveservice;

import com.tycoin.account.slaveentity.TycoinVerifyCode;
import com.tycoin.account.slaverepository.TycoinVerifyCodeRepository;
import com.tycoin.common.repository.AbstractRepository;
import com.tycoin.common.service.AbstractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(value = "slaveTransactionManager", readOnly = true)	
public class TycoinVerifyCodeService  extends AbstractService<TycoinVerifyCode, Long> {

	@Autowired
	private TycoinVerifyCodeRepository tycoinVerifyCodeRepository;
	
	@Override
	public AbstractRepository<TycoinVerifyCode, Long> getRepository() {
		
		return tycoinVerifyCodeRepository;
	}

	public TycoinVerifyCode findBymobile(String mobile){
		TycoinVerifyCode tycoinVerifyCode=tycoinVerifyCodeRepository.findOneBymobile(mobile);
		if(tycoinVerifyCode==null){
			tycoinVerifyCode=new TycoinVerifyCode();
		}
		return tycoinVerifyCode;
	}

}
